package com.itmuch.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.itmuch.cloud.Exclude;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;

/**
 * 轮询：
 *   1.创建一个注解类
 * 	 2.在启动类添加注解@ComponentScan
 * 	 3.在自定义的ribbon类上添加此注解
 * 	 4.重要的是在自定义的ribbon类上和启动类在同一包上面
*/
@Exclude
@Configuration
public class TestConfiguration {
	
	@Autowired
	private IClientConfig config;
	
	@Bean
	public IRule ribbonRule(IClientConfig config) {
		return new RandomRule();
	}
	
}
